<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<meta charset="UTF-8" />
<title>【顺风车】</title>
<link rel="stylesheet" href="../../static/assets/css/amazeui.css" th:href="@{/assets/css/amazeui.min.css}" />
<link rel="stylesheet" href="../../static/assets/css/amaze.min.css" th:href="@{/assets/css/amaze.min.css}" />
<link rel="stylesheet" href="../../static/assets/css/common.min.css" th:href="@{/assets/css/common.min.css}" />
<link rel="stylesheet" href="../../static/assets/css/other.min.css" th:href="@{/assets/css/other.min.css}" />
<link rel="stylesheet" href="../../static/assets/css/app2.css" th:href="@{/assets/css/app2.css}" />
<script th:inline="javascript">
	var r = [[${r}]];
	var totalPages = [[${page.totalPages}]];
</script>
</head>
<body class="register-container">
	<div th:include="common/header::header"></div>

	<br />
	<!--===========layout-container================-->
	<div class="am-container" style="background: #fff;">

		<div class="tpl-page-container tpl-page-header-fixed">

			<div th:include="common/nav::nav"></div>


			<div class="tpl-content-wrapper">

				<div class="row">
					<div class="tpl-portlet">
						<div class="tpl-portlet-title">
							<div class="tpl-caption font-green ">
								<span>接收订单</span>
							</div>

						</div>

						<div class="am-tabs tpl-index-tabs">
							<ul class="am-tabs-nav am-nav am-nav-tabs">
								<li th:class="${active=='1'}?'am-active':''">
									<a th:href="@{/front/order/ticket/1}">有效车票</a>
								</li>
								<li th:class="${active=='02'}?'am-active':''">
									<a th:href="@{/front/order/ticket/02}">历史车票</a>
								</li>
							</ul>

							<div class="am-tabs-bd">
								<div class="am-tab-panel am-fade am-in am-active">
									<table class="am-table am-table-compact am-table-centered">
										<thead>
											<tr>
												<th class="am-text-middle am-text-sm" width="50">序号</th>
												<th class="am-text-middle am-text-sm">出发地</th>
												<th class="am-text-middle am-text-sm">目的地</th>
												<th class="am-text-middle am-text-sm" width="80">出发日期</th>
												<th class="am-text-middle am-text-sm" width="80">出发时间</th>
												<th class="am-text-middle am-text-sm" width="50">价格</th>
												<th class="am-text-middle am-text-sm" width="160">司机信息</th>
												<th class="am-text-middle am-text-sm" width="40">状态</th>
												<th class="am-text-middle am-text-sm" width="110">操作</th>
											</tr>
										</thead>
										<tbody>
											<tr th:each="orderDetail,s : ${page.content}">
												<th class="am-text-middle am-text-xs" th:text="${s.index + 1}">index</th>
												<td class="am-text-middle am-text-xs" th:text="${orderDetail.order.startAddress}"></td>
												<td class="am-text-middle am-text-xs" th:text="${orderDetail.order.stopAddress}"></td>
												<td class="am-text-middle am-text-xs" th:text="${orderDetail.order.goDate}"></td>
												<td class="am-text-middle am-text-xs" th:text="${orderDetail.order.goTime}"></td>
												<td class="am-text-middle am-text-xs" th:text="${orderDetail.order.price1}"></td>
												<td class="am-text-middle am-text-xs">
													司机姓名：
													<span th:text="${orderDetail.order.user.realName}"></span>
													<br /> 联系电话：
													<span th:text="${orderDetail.order.user.passenger==null?'':orderDetail.order.user.passenger.phone}"></span>
													<br /> 车牌号码：
													<span th:text="${orderDetail.order.user.driver==null?'':orderDetail.order.user.driver.licencePlateNumber}"></span>
													<br />
												</td>
												<td class="am-text-middle am-text-xs" th:if="${active=='02'}">
													<span class="am-badge am-round am-badge-danger" th:text="${orderDetail.stateName}"
														th:if="${orderDetail.state==0}"></span>
													<span class="am-badge am-round am-badge-secondary" th:text="${orderDetail.stateName}"
														th:if="${orderDetail.state==1}"></span>
													<span class="am-badge am-round am-badge-success" th:text="${orderDetail.stateName}"
														th:if="${orderDetail.state==2}"></span>
												</td>
												<td class="am-text-middle am-text-xs" th:if="${active=='1'}">
													<span class="am-badge am-round am-badge-danger" th:text="${orderDetail.order.orderStateName}"
														th:if="${orderDetail.order.orderState==0}"></span>
													<span class="am-badge am-round am-badge-secondary"
														th:text="${orderDetail.order.orderStateName}+'-'+${orderDetail.order.orderProcessName}"
														th:if="${orderDetail.order.orderState==1}"></span>
													<span class="am-badge am-round am-badge-success"
														th:text="${orderDetail.order.orderStateName}+'-'+${orderDetail.order.orderProcessName}"
														th:if="${orderDetail.order.orderState==2}"></span>
													<span class="am-badge am-round am-badge-warning"
														th:text="${orderDetail.order.orderStateName}+'-'+${orderDetail.order.orderProcessName}"
														th:if="${orderDetail.order.orderState==3}"></span>
												</td>
												<td class="am-text-middle am-text-xs">
													<div class="am-btn-toolbar">
														<!-- 乘客菜单 -->
														<div class="am-btn-group am-btn-group-xs" sec:authorize="${hasAnyAuthority(1)}">
															<a th:if="${orderDetail.state==1 and orderDetail.order.orderState==1}"
																th:href="@{'/front/order/ticket/cancel/'+${orderDetail.id}}"
																class="am-btn am-btn-default am-btn-xs cancel"> 取消 </a>
															<a th:if="${orderDetail.state==1 and orderDetail.order.orderState==2}"
																th:href="@{'/front/order/ticket/payment/'+${orderDetail.id}}"
																class="am-btn am-btn-default am-btn-xs payment"> 付款 </a>
															<a th:if="${orderDetail.state==2 and orderDetail.order.orderState==3}"
																th:href="@{'/front/order/reserve/comment/'+${orderDetail.order.id}}"
																class="am-btn am-btn-default am-btn-xs comment"> 查看 </a>
														</div>
														<!-- 司机菜单 -->
														<div class="am-btn-group am-btn-group-xs" sec:authorize="${hasAnyAuthority(2)}">
															<a th:if="${orderDetail.state==1 and orderDetail.order.orderState==1}"
																th:href="@{'/front/order/ticket/confirm/'+${orderDetail.id}}"
																class="am-btn am-btn-default am-btn-xs confirm"> 确认 </a>
															<a th:if="${orderDetail.state==1 and orderDetail.order.orderState==1}"
																th:href="@{'/front/order/ticket/cancel/'+${orderDetail.id}}"
																class="am-btn am-btn-default am-btn-xs cancel"> 取消 </a>
															<a th:if="${orderDetail.state==2 and orderDetail.order.orderState==3}"
																th:href="@{'/front/order/reserve/view/'+${orderDetail.order.id}}"
																class="am-btn am-btn-default am-btn-xs view"> 查看 </a>
														</div>
													</div>
												</td>
											</tr>
										</tbody>
									</table>
									<div id="page"></div>
								</div>

							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<br />

	<div th:include="common/footer::footer"></div>

	<script src="../../static/assets/js/jquery-2.1.0.js" charset="utf-8" th:src="@{/assets/js/jquery-2.1.0.js}"></script>
	<script src="../../static/assets/js/amazeui.js" charset="utf-8" th:src="@{/assets/js/amazeui.js}"></script>
	<script src="../../static/assets/layer/layer.js" charset="utf-8" th:src="@{/assets/layer/layer.js}"></script>
	<script src="../../static/assets/laypage/laypage.js" charset="utf-8" th:src="@{/assets/laypage/laypage.js}"></script>
	<script src="../../static/assets/js/core.js" charset="utf-8" th:src="@{/assets/js/core.js}"></script>
</body>
<script type="text/javascript">
	if (r) {
		if (r.code == 0) {
			layer.msg(r.message, {
				icon : 1
			});
		} else {
			layer.msg(r.message, {
				icon : 2
			});
		}
	}
	
	$(".cancel").confirmOperator({
		msg : "确定要取消订单吗？"
	});
	$(".confirm").confirmOperator({
		msg : "确认后不能再取消订单。"
	});
	$(".payment").confirmOperator({
		msg : "确定付款吗？"
	});

	laypage({
		cont : 'page',
		pages : totalPages,
		curr : function() {
			var page = location.search.match(/page=(\d+)/);
			return page ? page[1] : 1;
		}(),
		jump : function(e, first) {
			if (!first) {
				location.href = '?page=' + e.curr;
			}
		}
	});
</script>
</html>
